package com.ophiux.wechat.controller;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

/**
 * @desc:
 * @author: hhl
 * @date：2023/10/13 10:38
 */
@RestController
@RequestMapping
@CrossOrigin
public class Test {

    @RequestMapping("/test")
    public String test(Integer id){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("patientId",1);
        jsonObject.put("patientName","hhl");
        jsonObject.put("patientAge",33);

        JSONObject jsonObject2 = new JSONObject();
        jsonObject2.put("patientId",2);
        jsonObject2.put("patientName","hhl2");
        jsonObject2.put("patientAge",31);

        JSONArray array = new JSONArray();
        array.add(jsonObject);
        array.add(jsonObject2);

        return array.toJSONString();
    }


    public static void main(String[] args) {

        JSONArray jsonArray = new JSONArray();

        JSONObject jsonObject = new JSONObject();
        jsonObject.put("patientId",1);
        jsonObject.put("1.填表人","患者本人");
        jsonObject.put("2.您是否首次来我院就诊?","是");

        jsonArray.add(jsonObject);
        jsonArray.add(jsonArray);


        for (String s : jsonObject.keySet()) {
            System.out.println(s);
            System.out.println(jsonObject.get(s));
        }

        System.out.println(1);

    }
}
